<?php
/*
	批量生成防伪码
	参数
		$goods_code		商品编号
		$batch_code		批次编号
		$serial_code	防伪码数量
		$seckey			加密密钥
	返回值
		$string			防伪码数组
*/
defined('BY_JYA') or exit('error');
list($goods_code,$batch_code,$serial_code,$seckey)=$arguments;
$setting=$this->plugin_setting('secury');//获取参数设置
$security_codes=array();
for($i=0;$i<=$serial_code;$i++){
	$temp=$setting['pre'].sprintf("%'0{$setting['goods']}s",$goods_code).sprintf("%'0{$setting['batch']}s",$batch_code).sprintf("%'0{$setting['serial']}s",$i);
	$check_code=cfc('tools')->create_check_code($temp,$seckey,$setting['code']);//校验码
	$garble_code=random($setting['garble'],true);//混淆码
	$security_code=$temp.$check_code.$garble_code;
	//$string.=custom_url('jy_security/search/main/code='.$security_code,true)."\n";
	$security_codes[]=$security_code;
}
return $security_codes;